package com.nciae.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.nciae.po.Rectification;
import com.nciae.dao.RectificationMapper;
import com.nciae.service.IRectificationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Guoliyu
 * @since 2022-03-30
 */
@Service
public class RectificationServiceImpl extends ServiceImpl<RectificationMapper, Rectification> implements IRectificationService {

    @Override
    public Rectification findBySecurityQuestionId(Long securityQuestionId) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("security_question_id", securityQuestionId);
        return baseMapper.selectOne(wrapper);
    }

    @Override
    public void add(Rectification rectification) {
         baseMapper.insert(rectification);
    }

    @Override
    public void update(Rectification rectification) {
        baseMapper.updateById(rectification);
    }
}
